@extends('frontend/layouts/bootstrap')

@section('content')
<h2>Нэхэмжлэлийн жагсаалт</h2>
<div id="notification"></div>
{{-- FILTER --}}
<div class="well well-small">
    <form class="form-inline" style="margin: 0;" action="{{ route('car_balance.bill.index') }}" method="get">
        {{-- Bill filter --}}
        <td>
            <input class="input-small" placeholder="日付" type="text" name="create_date" id="daterange" value="{{ count($filter_create_date) > 1 ? $filter_create_date[0] .' - '.$filter_create_date[1] : '' }}"/>
        </td>
        {{ Form::select('customer_id', $customer_list, $filter_customer_id, array('class' => 'input-small')) }}
        {{-- Form::token() --}}
        {{-- BUTTONS --}}
        <button type="submit" class="btn">Apply Filter</button>
        <a href="{{ route('car_balance.bill.index') }}" >Reset</a>
    </form>
</div>

@if ($bills->count())
<div>{{ $bills->getTotal() }} results.</div>
<div class="container-wrapper">
    <table class="table table-bordered table-condensed table-hover">
        <thead style="background-color: #f0f0f0; white-space:nowrap;">
        <tr>
            <th title="Action">Action</th>
            <th title="Create date">Create date</th>
            <th title="Expiry date">Expiry date</th>
            <th title="Customer">Customer</th>
            <th title="Carry over amount">Carry over amount</th>
            <th title="Bill amount">Bill amount</th>
            <th title="Penalty1 amount">Penalty1 amount</th>
            <th title="Penalty2 amount">Penalty2 amount</th>
            <th title="Total amount">Total amount</th>
        </tr>
        </thead>
        <tbody style="font-size: 11px;">
        @foreach($bills as $bill)
        <tr>
            <div style="position: absolute; z-index: 1;">
                <th>
                    <a class="btn btn-primary btn-mini" href="{{ route('car_balance.bill.detial', $bill->id) }}" title="Detial"><i class="icon-zoom-in icon-white"></i></a>
                </th>
                <th>{{ $bill->create_date }}</th>
                <th>{{ $bill->expiry_date }}</th>
                <td>{{ $bill->customer ? link_to_route('car_balance.customer.show', $bill->customer->name, $bill->customer->id, array()) : 'NULL' }}</td>
                <td style="text-align: right;">{{ $bill->carry_over_amount ? number_format($bill->carry_over_amount, 0) : 0; }}</td>
                <td style="text-align: right;">{{ $bill->bill_amount ? number_format($bill->bill_amount, 0) : 0; }}</td>
                <td style="text-align: right;">{{ $bill->penalty1_amount ? number_format($bill->penalty1_amount, 0) : 0; }}</td>
                <td style="text-align: right;">{{ $bill->penalty2_amount ? number_format($bill->penalty2_amount, 0) : 0; }}</td>
                <td style="text-align: right;">{{ $bill->total_amount ? number_format($bill->total_amount, 0) : 0; }}</td>
            </div>
        </tr>
        @endforeach
        </tbody>
    </table>
</div>
@include('nimo/domains/car_balance/page')

@else
Хайлтад тохирох үр дүн алга
@endif

@stop

@section('pagestyles')
<link rel="stylesheet" type="text/css" href={{ asset('assets/chosen-bootstrap/chosen.min.css') }} />
<link rel="stylesheet" type="text/css" href={{ asset('assets/bootstrap-daterangepicker/daterangepicker.css') }} />
<style type="text/css" media="screen">
</style>

@stop

@section('pagescripts')
<!--page specific plugin scripts-->
<script type="text/javascript" src={{ asset('assets/chosen-bootstrap/chosen.jquery.min.js') }}></script>
<script type="text/javascript" src={{ asset('assets/bootstrap-daterangepicker/date.js') }} ></script>
<script type="text/javascript" src={{ asset('assets/bootstrap-daterangepicker/daterangepicker.js') }}></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('input[name="create_date"]').daterangepicker({
            format:"yyyy/MM/dd"
        });
    });
</script>
@stop